From c043f762e14b35a8a128427f941f78af78c1327a Mon Sep 17 00:00:00 2001 From: "kmacy@netapp.com[kaf24]" Date: Mon, 2 May 2005 13:50:40 +0000 Subject: [PATCH] bitkeeper revision 1.1389.1.25 (42763030SYN-c5A47iaiRMSIUFsKbA) [PATCH] [PATCH] fix booting with SMP enabled Let me know if pine has messed up the patch the way gmail does. # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/04/30 16:07:55-07:00 kmacy@curly.lab.netapp.com # Make FreeBSD work with SMP enabled again # Kip Macy # # BitKeeper/etc/logging_ok # 2005/04/30 16:07:54-07:00 kmacy@curly.lab.netapp.com +1 -0 # Logging to logging@openlogging.org accepted # # freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c # 2005/04/30 16:07:39-07:00 kmacy@curly.lab.netapp.com +22 -12 # Do shadow directory initialization before SMP page table setup # # freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c # 2005/04/30 16:07:39-07:00 kmacy@curly.lab.netapp.com +2 -1 # Don't try to probe apics # --- .../i386-xen/i386-xen/local_apic.c | 3 +- .../i386-xen/i386-xen/machdep.c | 34 ++++++++++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c index 8fb7f9f12e..7b8fa1b2e5 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c @@ -545,7 +545,6 @@ apic_register_enumerator(struct apic_enumerator *enumerator) static void apic_init(void *dummy __unused) { - struct apic_enumerator *enumerator; uint64_t apic_base; int retval, best; @@ -560,6 +559,7 @@ apic_init(void *dummy __unused) /* First, probe all the enumerators to find the best match. */ best_enum = NULL; best = 0; +#ifndef XEN SLIST_FOREACH(enumerator, &enumerators, apic_next) { retval = enumerator->apic_probe(); if (retval > 0) @@ -569,6 +569,7 @@ apic_init(void *dummy __unused) best = retval; } } +#endif if (best_enum == NULL) { if (bootverbose) printf("APIC: Could not find any APICs.\n"); diff --git a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c index b61d9ceeb4..ba1adb1de9 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c @@ -1386,6 +1386,7 @@ initvalues(start_info_t *startinfo) { int i; vm_paddr_t pdir_shadow_ma, KPTphys; + vm_offset_t *pdir_shadow; #ifdef WRITABLE_PAGETABLES printk("using writable pagetables\n"); HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); @@ -1424,6 +1425,27 @@ initvalues(start_info_t *startinfo) /* allocate page for ldt */ ldt = (union descriptor *)(KERNBASE + (tmpindex << PAGE_SHIFT)); tmpindex++; + + /* initialize page directory shadow page */ + pdir_shadow = (vm_offset_t *)(KERNBASE + (tmpindex << PAGE_SHIFT)); + i686_pagezero(pdir_shadow); + pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT); + PT_SET_MA(pdir_shadow, pdir_shadow_ma | PG_V | PG_A); + tmpindex++; + + /* setup shadow mapping first so vtomach will work */ + xen_pt_pin((vm_paddr_t)pdir_shadow_ma); + xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), + pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M); + xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), + ((vm_paddr_t)IdlePTD) | PG_V | PG_A); + xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), + KPTphys | PG_V | PG_A); + + xen_flush_queue(); + /* allocate remainder of NKPT pages */ + + #ifdef SMP /* allocate cpu0 private page */ cpu0prvpage = (KERNBASE + (tmpindex << PAGE_SHIFT)); @@ -1458,18 +1480,6 @@ initvalues(start_info_t *startinfo) xen_queue_pt_update(KPTphys + i*sizeof(vm_paddr_t), 0); xen_flush_queue(); - pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT); - tmpindex++; - - /* setup shadow mapping first so vtomach will work */ - xen_pt_pin((vm_paddr_t)pdir_shadow_ma); - xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), - pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M); - xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), - ((vm_paddr_t)IdlePTD) | PG_V | PG_A); - xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), - KPTphys | PG_V | PG_A); - /* allocate remainder of NKPT pages */ for (i = 0; i < NKPT-1; i++, tmpindex++) { xen_queue_pt_update((vm_paddr_t)(IdlePTD + KPTDI + i + 1), -- 2.30.2